<%def name="text_field(id, name, error=None, help=None, **kwargs)">
<label for="${id}">${name}</label>
<input id="${id}" name="${id}" type="text" ${make_attributes(**kwargs)}/>
% if isinstance(c.form_errors, dict) and id in c.form_errors:
<span class="error">${c.form_errors[id]}</span>
% endif
% if help:
<div class="help">${help}</div>
% endif
</%def>

<%def name="number_field(id, name, error=None, help=None, **kwargs)">
<label for="${id}">${name}</label>
<input id="${id}" name="${id}" type="number" ${make_attributes(**kwargs)}/>
% if isinstance(c.form_errors, dict) and id in c.form_errors:
<span class="error">${c.form_errors[id]}</span>
% endif
% if help:
<div class="help">${help}</div>
% endif
</%def>

<%def name="make_attributes(**kwargs)">\
% for (attr, value) in kwargs.iteritems():
  % if isinstance(value, bool) and value:
 ${attr}\
  % else:
 ${attr}="${value}"\
  % endif
% endfor
</%def>
